package com.simplefaith.delisty.model;

import android.app.Activity;
import android.os.Handler;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

public class SwitchSplashHandler extends Handler {

	private Runnable run;

	public SwitchSplashHandler(final Activity activity, final int splashViewID) {

		
		this.run = new Runnable() {
			@Override
			public void run() {

				View view = activity.findViewById(android.R.id.content);

				Animation animation = AnimationUtils.loadAnimation(activity,
						com.simplefaith.delisty.R.anim.activity_fadeout);

				view.setAnimation(animation);

				
				// Switch Splash View
				activity.setContentView(splashViewID);

				removeCallbacks(run);
			}
		};
	}

	public void startHandler(long delayMills) {
		this.postDelayed(run, delayMills);
	}

}
